*******************************************************************************
* Specify city and years; load data
*******************************************************************************

local city = "east_baton_rouge"

local y1 2012
local y2 2016
local y3 2020

use dataset_`city'_panel_pres, clear

******************************************************************************
* Change in support and share black
******************************************************************************

foreach year in `y2' `y3' {
	
	#delimit;

	gr tw
		(sc dpctdem pctnhblack [aw=totalvotes] if year ==`year',
			msym(Oh) msize(tiny))
		(lpoly dpctdem pctnhblack [aw=totalvotes] if year ==`year',
			col(black) lwid(thick))
		,
			name(g`year', replace)
			plotregion(style(none))
			ylab(, angle(horiz) format(%9.0g))
			//yscale(titlegap(*-7))
			legend(off)
			yline(0, lpat(dash))
			title(`year')
			scale(1.3)
			;
	
	#delimit cr
	
	gr close
	
}

gr combine g`y2' g`y3', ycommon xcommon ///
	l1title("Change in Democratic Vote") b1title("Share Black") ///
	rows(1) xsize(2) ysize(1) 

gr export "_output/figure A19 a.pdf", replace

*******************************************************************************
* Change in support and distance to shooting
*******************************************************************************

foreach year in `y2' `y3'{
	
	#delimit;

	gr tw
		(sc dpctdem distance [aw=totalvotes] if year == `year',
			msym(Oh) msize(tiny))
		(lpoly dpctdem distance [aw=totalvotes] if year == `year',
			col(black) lwid(thick))
		,
			name(g`year', replace)
			plotregion(style(none))
			ylab(, angle(horiz) format(%9.0g))
			//yscale(titlegap(*-7))
			legend(off)
			yline(0, lpat(dash))
			title(`year')
			scale(1.3)
			xscale(reverse)
			;
	
	#delimit cr
	
	gr close
	
}

gr combine g`y2' g2020, ycommon xcommon ///
	l1title("Change in Democratic Vote") ///
	b1title("Distance to Shooting (Miles)") ///
	rows(1) xsize(2) ysize(1)
	
gr export "_output/figure A19 b.pdf", replace
	
*******************************************************************************
* End
*******************************************************************************
